package models

type TrainCarinfo struct {
	Id                   int    `xorm:"not null pk autoincr comment('自增主键') INT(11)" json:"id"`
	Cartype              string `xorm:"not null comment('车型  A1 A2 A3 B1 B2 C1 C2 C3 C4 D E F') CHAR(4)" json:"cartype"`
	HoursSubject1        int64  `xorm:"comment('科目一学时  单位：小时') INT(8)" json:"hours_subject_1"`
	HoursSubject2        int64  `xorm:"comment('科目二学时 单位：小时') INT(8)" json:"hours_subject_2"`
	HoursSubject3        int64  `xorm:"comment('科目三学时  单位：小时') INT(8)" json:"hours_subject_3"`
	HoursSubject4        int64  `xorm:"comment('科目四学时  单位：小时') INT(8)" json:"hours_subject_4"`
	TotalHours           int    `xorm:"comment('总学时  单位：小时') INT(8)" json:"total_hours"`
	TotalmileageSubject1 int    `xorm:"default 0 comment('科目一总里程数  （单位：公里）') INT(8)" json:"totalmileage_subject_1"`
	TotalmileageSubject2 int    `xorm:"comment('科目二总里程数  （单位：公里）') INT(8)" json:"totalmileage_subject_2"`
	TotalmileageSubject3 int    `xorm:"comment('科目三总里程数  （单位：公里）') INT(8)" json:"totalmileage_subject_3"`
	TotalmileageSubject4 int    `xorm:"default 0 comment('科目四总里程数  （单位：公里）') INT(8)" json:"totalmileage_subject_4"`
}

func (c *TrainCarinfo) GetTrainCarinfo(car_type string) (list *TrainCarinfo, err error) {
	list = new(TrainCarinfo)
	_, err = engine.Table("dts_train_carinfo").Where("cartype = ?", car_type).Get(list)
	return list, err
}
func (c *TrainCarinfo) GetTrainCarinfoList() (list []*TrainCarinfo, err error) {
	err = engine.Table("dts_train_carinfo").Find(&list)
	return list, err
}

// 学员学时信息
type StuLearnCarInfo struct {
	LearnTime    string `json:"learn_time"`
	TotalTime    int64  `json:"total_time"`
	Mileage      string `json:"mileage"`
	TotalMileage int64  `json:"total_mileage"`
}
